/*
 * Class BlowfishTest.java
 * @author Guillermo Moraleda
 * @author Loles Salmeron
 *
 * Test of the Blowfish encryption and decryption.
 *
 */
package kau.cs.lab.blowfish;

public class BlowfishTest {

    public static void main(String args[]) throws Exception {
        byte[] message = "asdASDasd".getBytes();
        byte[] key = "test1234".getBytes();

        System.out.println(new String(message));

        Blowfish bf = new Blowfish();
        bf.Blowfish_Init(key);
        System.out.println("Plain Text      :" + new String(message));
        System.out.println("Key             :" + Blowfish.getHexString(key));
        byte[] encrypted = bf.crypt(message, true);
        System.out.println("Cipher Text     :" + Blowfish.getHexString(encrypted));
        byte[] decrypted = bf.crypt(encrypted, false);
        System.out.println("Decrypted Text  :" + new String(decrypted));
        bf.reset();
    }
}
